package com.gy.training.p;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;


/**
 * Created by 01368324 on 2017/8/18.
 */

public class SMSBroadcastReceiver extends BroadcastReceiver {
   private MessageListener mMessageListener;
    @Override
    public void onReceive(Context context, Intent intent) {
        String content = intent.getStringExtra("BODY");
        System.out.println("@短信地址： "+intent.getStringExtra("ADDRESS"));
        System.out.println("@短信内容： "+intent.getStringExtra("BODY"));

        mMessageListener.OnReceived(content);
    }

 public interface MessageListener {
    void OnReceived(String message);
  }
    public void setOnReceivedMessageListener(MessageListener messageListener) {
        this.mMessageListener=messageListener;
    }
}
